<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        // // 语法糖
        // // es6
        // class IPhone {

        //     constructor (id) {
        //         this.id = id;
        //     }

        //     brand = 'apple';
        //     version = '13 pro';
        //     color = 'blue';
        //     heySiri = () => {
        //         const fn = () => {
        //             console.log(this);
        //         }
        //         console.log(this); // instance
        //         fn();
        //     };
        // }

        // const phone = new IPhone(123);

        // phone.heySiri(); // instance

        // console.log(phone.id); // 123

        class Parent {
            constructor (x, y) {
                this.x = x;
                this.y = y;
            }
            sayHi () {
                console.log(this);
            }
        }

        class Child extends Parent {
             constructor (x, y) {
                super(x, y); // 调用父类的constructor
             }
        }

        const c = new Child(1, 3);

        c.sayHi();


    </script>
</body>
</html>